"use client"; import { GameListRep, getFreeGamesApi, SearchProps } from "@/api/home"; import Box from "@/components/Box"; import GroupCard from "@/components/Card/GroupCard"; import HeaderBack from "@/components/HeaderBack"; import { BalanceContent, BonusContent, FreeContent, ReplayContent, } from "@/components/ModalPopup/WalletDescribeModal"; import TipsModal, { ModalProps } from "@/components/TipsModal"; import { useWalletStore } from "@/stores/useWalletStore"; import { Pagination, WalletEnum } from "@/types"; import { useSetState } from "ahooks"; import { InfiniteScroll } from "antd-mobile"; import { useTranslations } from "next-intl"; import { FC, useRef, useState } from "react"; const Header = () => { const { wallet } = useWalletStore((state) => ({ wallet: state.wallet, })); const t = useTranslations("ProfilePage"); const tipsRef = useRef(null); const [tipsStatus, setTipsStatus] = useState("Bonus"); const modalHandler = (key: keyof typeof WalletEnum) => { setTipsStatus(key); tipsRef.current?.onOpen(); }; return ( <>
modalHandler("Free")} > {wallet.free_score}
{t("modalTitle")} } > {/*现金*/} {tipsStatus === WalletEnum.Balance ? : null} {/* 彩金*/} {tipsStatus === WalletEnum.Bonus ? : null} {/* 免费币 */} {tipsStatus === WalletEnum.Free ? : null} {/* 重玩币 */} {tipsStatus === WalletEnum.Replay ? : null} ); }; const GameListFlag: FC = () => { const [target, setTarget] = useSetState<{ games: GameListRep[]; page: Partial }>({ games: [], page: { is_end: false }, }); const params = useRef({ current_page: 0, page_size: 15, use_page: true, }); const getGames = async (): Promise => { return getFreeGamesApi(params.current).then((res) => { if (res.code === 200) { setTarget((value) => ({ page: res.page, games: [...value.games, ...res.data] })); return res.data; } }); }; const loadMore = async () => { params.current.current_page += 1; await getGames(); }; return ( <>
); }; export default GameListFlag;